 <template>
  <div slot="book">
    <a-card
     
      :isbn="book.isbn"
      :marcid="book.bookid"
      :headStyle="headStyles"
      style="width: 100%"
    >
    <div slot="title"  @click="godetail(book.id, book.title,book.ebooklist.marcRecNo)">{{book.title}}</div>
      <a-row :gutter="16" type="flex" justify="space-around" align="middle">
        <a-col
          :xs="23"
          :sm="23"
          :md="8"
          :lg="6"
          :xl="4"
          @click="godetail(book.id, book.title,book.ebooklist.marcRecNo)"
        >
          <img
            align="center"
            :src="book.cover"
            width="100%"
            style="margin: 0 auto; display: block"
          />
        </a-col>
        <a-col :xs="1" :sm="1" :md="1" :lg="1" :xl="1"> </a-col>

        <a-col :xs="24" :sm="24" :md="13" :lg="15" :xl="19">
          <a-row>
            <blockquote>
              <p class="list-group-item-text text-muted" name="author">
                作者:{{ book.author }}&nbsp;&nbsp;/&nbsp;&nbsp;出版日期:{{
                  book.publish_date
                }}&nbsp;&nbsp;/&nbsp;&nbsp;提供商:{{ book.src }}
              </p>
              <p
                class="list-group-item-text text-muted"
                name="isbn"
                :value="book.isbn"
              >
                ISBN:{{ book.bisbn }}&nbsp;&nbsp;/&nbsp;&nbsp;分类:{{
                  book.cates
                }}&nbsp;&nbsp;/&nbsp;&nbsp;格式:{{ book.filetype }}
              </p>
            </blockquote>
          </a-row>
          <!-- 来源 start -->
          <a-row>
            <blockquote>
              <div class="source">
                <div
                  v-for="(item, indexs) in book.srcarrname"
                  :key="indexs"
                  class="sourceList"
                >
                  {{ item }} :
                  <a-button
                    type="dashed"
                    v-for="(item, j) in book.srcarrkey"
                    :key="j"
                  >
                    <a :href="book.srcarrkeyhref[j]" target="_blank">{{
                      item
                    }}</a>
                  </a-button>
                </div>
                <div
                  v-show="book.ebooklist != '' && book.ebooklist != undefined"
                  style="margin-top: 10px"
                >
                  <a
                    @click="
                      EmitGetBookInfo(
                        book.ebooklist.marcRecNo,
                        book.ebooklist.title
                      )
                    "
                    target="_blank"
                    class="btn-successread"
                    >本馆纸书</a
                  >
                </div>
              </div>
            </blockquote>
          </a-row>
          <!-- 来源end -->
          <a-row data-id="intro">
            <p class="list-group-item-text">{{ book.intro }}</p>
          </a-row>
          <!-- <a-row v-show="book.ebooklist !='' && book.ebooklist != undefined">
                        <a-divider dashed />
                      </a-row> -->
          <!-- <a-row>
                        <a-col
                          :xs="24"
                          :sm="24"
                          :md="13"
                          :lg="24"
                          style="display: flex"
                        >
                          <a
                            :href="book.read"
                            target="_blank"
                            class="btn-successread"
                            >电子书点此阅读</a
                          >
                          
                        </a-col>
                      </a-row> -->
          <a-row v-if="book.sample1 != ''">
            <a-col :xs="24" :sm="24" :md="13" :lg="24">
              <a-table
                :columns="columns"
                :data-source="book.sample1"
                :scroll="{ y: 240 }"
                size="middle"
                :pagination="false"
              >
                <a
                  slot="action"
                  slot-scope="item"
                  href="javascript:;"
                  @click="chaolianjie(item)"
                  >点击查看 <a-icon type="swap-right"
                /></a>
              </a-table>
            </a-col>
          </a-row>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>

<script>
// import axios from "axios";
// import VueAxios from "vue-axios";

export default {
  props: {
    book: Object,
    sample1: Array,
    id: Number,
    title: String,
    author: String,
    publisher: String,
    publish_date: String,
    pub_year: Number,
    cover: String,
    intro: String,
    isbn: String,
    bisbn: String,
    category: String,
    cates: String,
    booktype: String,
    filetype: String,
    bookid: String,
    assertId: String,
    src: Array,
    urls: Array,
    view_count: Number,
    extid: String,
    ext: String,
    created_at: Number,
    updated_at: Number,
    pc_read: String,
    pc_epub: String,
    wx_read: String,
    wx_epub: String,
    read: String,
    detail: String,
    content: String,
    ebooklist: Array,
    srcarrname: Array,
    srcarrkey: Array,
    srcarrkeyhref: Array,
  },
  data: () => ({
    is_bookinfo_visible: false,
    is_spinning: false,
    header: {},
    body: {},
    info: [],
    headStyles: {
      color: "#2780e3",
      background: "#f5f5f5",
    },
    customStyle: "color:#2780e3",
    columns: [
      {
        title: "标题",
        dataIndex: "title",
      },
      {
        title: "类型",
        dataIndex: "typeName",
      },
      {
        title: "",

        slots: { title: "link" },
        // width: 150,

        // dataIndex: '',
        key: "x",
        scopedSlots: { customRender: "action" },
        dataIndex: "link",
      },
    ],
  }),
  watch: {},
  computed: {
    getclassname() {
      return this.$store.state.Namedparent.name;
    },
  },
  methods: {
    chaolianjie(e) {
      window.open(e);
    },
    // gopagerbook(e){
    //   let routeUrl =this.$router.resolve({
    //      path:'/PaperbookSearch',
    //     query:{
    //       searchtitle: e,
    //     }
    //   })
    //   window.open(routeUrl.href, '_blank');
    // },
    // 获取列表
    godetail(id, title,marc_no) {
      // this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',true)
      var paras = {
        id: id,
        searchtitle: title,
        type: this.$store.state.Namedparent.name,
        marc_no:marc_no ? marc_no : ''
      };
      this.$store.commit(
        this.$store.state.Namedparent.name + "/ChangeDetailQuery",
        paras
      );
      this.$router.push({
        path: "/NewEBookDetail", //QikanrBookDetail
        query: {
          searchtitle: title,
          id: id,
           marc_no:marc_no ? marc_no : ''
        },
      });
    },
    // 展示侧边栏
    showDrawer() {
      this.is_bookinfo_visible = true;
      this.$emit("showbookid", true, this.bookid, this.title);
      this.$store.commit("NewEbook/BOOKINFO_ALREADY_SHOW", true);
    },
    // 关闭侧边栏
    onDrawerClose() {
      this.is_bookinfo_visible = false;
      this.$emit("showbookid", false);
      this.$store.commit("NewEbook/BOOKINFO_ALREADY_SHOW", false);
    },
    // 查看本馆纸书
    EmitGetBookInfo(marc_no, title) {
      this.$emit("showbookid", false, marc_no, title);
      this.$store.commit("NewEbook/BOOKINFO_ALREADY_SHOW", false);
    },
  },
  mounted() {
    if (this.$route.name == "detail") {
      this.$store.commit(
        this.$store.state.Namedparent.name + "/SHOW_DETAIL",
        true
      );
    } else {
      this.$store.commit(
        this.$store.state.Namedparent.name + "/SHOW_DETAIL",
        false
      );
    }
    // this.$store.commit(this.$store.state.Namedparent.name+'/SHOW_DETAIL',true)

    // console.log(this.muluText)
    // var marc_no = this.$route.params.id;

    // console.log(" %c htis marc_no: ", "color:brown;", marc_no);
    // if (marc_no == this.bookid) {
    // if (!this.is_bookinfo_visible) {
    // this.is_bookinfo_visible = true;
    // this.GetBookInfo(marc_no);
    // this.$emit("ShowBookid", marc_no);
    // }
    // }
  },
};
</script>

<style scoped>
/deep/.ant-collapse-header {
  color: blueviolet !important;
}
.text-muted {
  font-size: 15px;
}
.text-muted p {
  border-bottom: 1px dashed #efefef;
  line-height: 2;
}
.text-muteds {
  text-align: center;
  margin: 5px auto;
}
.text-muteds p {
  margin: 0;
  height: 20px;
  line-height: 20px;
  overflow: hidden;
}
.btn-success {
  color: #ffffff;
  text-align: center;
  border: 1px dashed #3fb618;
  padding: 3px 10px;
  font-size: 15px;
  border-radius: 4px;
}
.btn-successread {
  display: inline;
  color: #3fb618;
  text-align: center;
  border: 1px dashed #3fb618;
  padding: 3px 10px;
  font-size: 15px;
  border-radius: 4px;
  line-height: 1.8;
}
.btn-successread:hover {
  border: 1px dashed #5071df;
  color: #5071df;
}
.bookurl {
  width: 100%;
  display: block;
  height: 50px;
  position: absolute;
  top: 0;
  left: 0;
}
blockquote {
  padding: 10.5px 21px;
  margin: 0 0 21px;
  font-size: 18.75px;
  border-left: 5px solid #e6e6e6;
}
.list-group-item-text {
  margin-bottom: 0;
  line-height: 1.6;
}
.text-muted {
  color: #999999;
}
.source {
  width: auto;
  /* background: #f9fbfb; */
  border-color: #87e8de;
  border-radius: 4px;
  padding: 0 7px;
  display: inline-block;
}
.source button {
  margin: 0 7px;
}
</style>
